package com.yxhl.zoume.domain.interactor.pay;

import com.yxhl.zoume.data.http.repository.pay.PaymentRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.pay.AliPaySignStrParam;
import com.yxhl.zoume.data.http.rest.response.pay.ALiPaySignStrResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by vhawk on 16/4/5.
 */
public class ALiPaySignStrUseCase extends UseCase<ALiPaySignStrResponse> {
    private PaymentRepository repository;

    @Inject
    public ALiPaySignStrUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread,
                                @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
                                PaymentRepository repository) {
        super(uiThread, executorThread);
        this.repository = repository;
    }

    @Override
    protected Observable<ALiPaySignStrResponse> buildObservable(RequestParamImpl param) {
        return repository.aliPaySignStr((AliPaySignStrParam) param)
                .observeOn(uiThread)
                .subscribeOn(executorThread);
    }
}
